import request from "@/utils/request";


/**
 * 获取左侧菜单
 * @returns {*}
 */
export const getLeftMenusAPI = () => {
    return request({
        url: "/system/api/menu/getLeftMenu"
    })
}
//查询所有的菜单
export function listAllMenus () {
    return request({
        url: "/system/api/menu/selectAllMenu",
        method:'get'
    })
}
//条件查询
export const listMenuForPage = (data) => {
    return request({
        url: "/system/api/menu/findMuneByCond",
        method: "POST",
        data
    })
}

export function addMenu(data) {
    return request({
        url: '/system/api/menu/addMenu',
        method: 'post',
        params: data
    })
}
export function updateMenu(data) {
    return request({
        url: '/system/api/menu/updateMenu',
        method: 'post',
        data
    })
}
// 查询一个
export function getMenuById(id) {
    return request({
        url: `/system/api/menu/getMenuByMenuId/${id}`,
        method: 'post'
    })
}
// 删除
export function deleteMenuById(id) {
    return request({
        url: `/system/api/menu/deleteMenuById/${id}`,
        method: 'delete'
    })

}
// 根据角色ID查询当前角色ID拥有的权限菜单
export function getMenuIdsByRoleId(roleId) {
    return request({
        url: '/system/menu/selectMenusByRoleId/' + roleId,
        method: 'get'
    })
}
// 保存角色和菜单之间的关系
export function saveRoleMenu(roleId, data) {
    return request({
        url: `/system/menu/saveRoleMenu/${roleId}`,
        method: 'post',
        data
    })
}
